import React, { memo, useEffect } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import Mytable from '@/components/my-table/mytable';
import { changeUsersAction } from '../../store/actionCreators';
/* 用户界面 */
export default memo(function User() {
  /* 执行redux更改数据 获取数据传入表格组件 */
  const dispatch = useDispatch();
  const { usersList } = useSelector(
    (state) => ({
      usersList: state.getIn(['index', 'usersList']),
    }),
    shallowEqual,
  );
  useEffect(() => {
    dispatch(changeUsersAction());
  }, [dispatch]);
  return (
    <div>
      <Mytable dataList={usersList} />
    </div>
  );
});
